package com.tul.exercise.base.innerclass.chapter10_4;

/**
 * @Description 《java编程思想》10.4 示例 1
 *  内部类与向上类型转换
 **/
public class Pacel4 {
    private class PContents implements Contents {
        private int i = 11;
        @Override
        public int value() {
            return i;
        }
    }

    private class PDestination implements Destination{

        private PDestination(String whereTo) {
            label = whereTo;
        }
        private String label;
        @Override
        public String readLabel() {
            return label;
        }
    }

    public Contents contents() {
        return new PContents();
    }

    public Destination destination(String s) {
        return new PDestination(s);
    }
}
